***Replication file for "What are the drivers of diplomacy? Introducing and testing new annual dyadic data measuring diplomatic exchange", Journal of Peace Research, 2020
*Authors: Jonathan D. Moyer, Sara D. Turner, and Collin J. Meisel
*This file replicates and extends the results of Eric Neumayer's 2008 paper "Distance, Power, and Ideology". it does
*so by replaing the original COW diplomatic representaion data with updated and improved annual representation data 
*collected at the Frederick S. Pardee Center for International Futures at the Josef Korbel School for International Studies

**Code addapted from the corrected replication files used for Neumayer, E. Distance, Power and Ideology: Diplomatic Representation in a Spatial, Unequal and Divided World, Area, 40 (2), 2008, pp. 228-236 available at: http://www.lse.ac.uk/website-archive/GeographyAndEnvironment/neumayer/replicationdatasets.aspx

**Data Sources
**Neumayer: Diplomatic representation, distance, power, affinity, GDPPC 
**Diplometrics: Diplomatic representation data


*****************************************************************************************
*********************************REPLICATION OF NEUMAYER*********************************
*****************************************************************************************
clear

*Note: data are in 5-year increments
use final_5_yr_blocks.dta, clear


****Summary Tables****

* original data
 xi: logit  neu_dr_at_recipient_dum  neu_lndistance neu_powerpc_recipient ///
 neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient ///
 c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
 neu_westandruscoldummy neu_dr_at_sender_dum  if  Corrected_samedyad==0, 

su neu_dr_at_recipient_dum binemb_neubirth neu_lndistance neu_powerpc_recipient ///
 neu_powerpc_sender  neu_s3uni  neu_lngdppc_recipient  neu_lngdppc_sender  ///
 c.neu_s3uni#c.neu_powerpc_recipient c.neu_s3uni#c.neu_powerpc_sender   ///
 neu_lngdppc_recipient neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy ///
 neu_dr_at_sender_dum  neu_bilattradegdp_sender neu_independence_sender ///
 neu_demdem neu_autocautoc  if e(sample)

*new embassy data
 xi: logit  binemb_neubirth  neu_lndistance neu_powerpc_recipient ///
  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender  ///
  neu_westandruscoldummy binemb_sender  if  Corrected_samedyad==0, 

su neu_dr_at_recipient_dum binemb_neubirth neu_lndistance neu_powerpc_recipient ///
 neu_powerpc_sender    neu_s3uni  neu_lngdppc_recipient  neu_lngdppc_sender  ///
 c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender  ///
 neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy ///
 binemb_sender  neu_bilattradegdp_sender neu_independence_sender ///
 neu_demdem neu_autocautoc  if e(sample)

****Primary Results with Neumayer****
 
*Model 1: Neumayer data
xi: logistic  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient ///
  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
  neu_westandruscoldummy if  Corrected_samedyad==0, cluster( neu_dyadid)
  
			*run as an ordered logit model in response to reviewer comments on Table 1
			  ologit neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient ///
			  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
			  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
			  neu_westandruscoldummy if  Corrected_samedyad==0, cluster( neu_dyadid)
  
		   *run as a multinomial logit model in response to reviewer comments on Table 1
			  mlogit neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient ///
			  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
			  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
			  neu_westandruscoldummy if  Corrected_samedyad==0, cluster( neu_dyadid)
			  
xi: logistic  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient ///
  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
  neu_westandruscoldummy if  Corrected_samedyad==0, cluster( neu_dyadid)

estat sum
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
			*Re-run margins command save results for combo margins plot
			margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 (0.1) 4.8)) atmeans saving(model1rec, replace)
			*Create a conditional margins plot with shaded confidence intervals 
			marginsplot, x(neu_powerpc_recipient)recastci(rarea) xlabel(-2.2(1)4.8) 
			*Store model estimates
			est store model1rec
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
			*Re-run margins command & save results for combo margins plot
			margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 (0.1) 4.8)) atmeans saving(model1send, replace)
			*Create a conditional margins plot with shaded confidence intervals 
			marginsplot, x(neu_powerpc_sender)recastci(rarea) xlabel(-2.2(1)4.8) 
			*CStore model estimates
			est store model1send
margins, dydx(*) atmeans
eststo neumayer
 
		*Create Margins Plot for Interaction Variables - Recipient
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_recipient=(-2.2(1)4.8)) 
		marginsplot, x(neu_s3uni) xlabel(-1(0.5)1)
		
		*Create Margins Plot for Interaction Variables - Sender
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_sender=(-2.2(1)4.8)) 
		marginsplot, x(neu_s3uni) xlabel(-1(0.5)1)
		
		*Create Contour Plot for Interaction Variables - Recipient
		quietly margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_recipient=(-2.2(1)4.8)) saving(model1recippredictions, replace)
		use model1recippredictions, clear
		rename _at4 neu_s3uni
		rename _at2 neu_powerpc_recipient
		rename _margin pr_diploengagement
		twoway (contour pr_diploengagement neu_powerpc_recipient neu_s3uni,/*
		*/ccuts(0(0.1)1)), ylabel(-2.2(1)4.8, angle(horizontal)) xtitle("{bf}Affinity")/*
		*/ytitle("{bf}Recipient Power (standard dev.)") ztitle("{bf}Probability of Embassy Presence")/*
		*/title("{bf}Interaction Effect of Recipient Power on Affinity as a Driver""{bf}of Embassy Presence: Model 1")/*
		*/scheme(s2mono)
		
		*Create Contour Plot for Interaction Variables - Sender
		use final_5_yr_blocks.dta, clear
		xi: logistic  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient ///
		  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
		  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
		  neu_westandruscoldummy if  Corrected_samedyad==0, cluster( neu_dyadid)		
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_sender=(-2.2(1)4.8)) saving(model1sendpredictions, replace)
		use model1sendpredictions, clear
		rename _at4 neu_s3uni
		rename _at3 neu_powerpc_sender
		rename _margin pr_diploengagement
		twoway (contour pr_diploengagement neu_powerpc_sender neu_s3uni,/*
		*/ccuts(0(0.1)1)), ylabel(-2.2(1)4.8, angle(horizontal)) xtitle("{bf}Affinity")/*
		*/ytitle("{bf}Sender Power (standard dev.)") ztitle("{bf}Probability of Embassy Presence")/*
		*/title("{bf}Interaction Effect of Sender Power on Affinity as a Driver""{bf}of Embassy Presence: Model 1")/*
		*/scheme(s2mono)
		
 
*Model 2: Neumayer Data + year
use final_5_yr_blocks.dta, clear
xi: logistic neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient ///
  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
  neu_westandruscoldummy  i.year if  Corrected_samedyad==0, cluster( neu_dyadid)

estat class
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans
eststo neumayer_year

		*Create Margins Plot for Interaction Variables
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_recipient=(-2.2(1)4.8)) 
		marginsplot, x(neu_s3uni) xlabel(-1(0.5)1)
		
		*Create Margins Plot for Interaction Variables
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_sender=(-2.2(1)4.8)) 
		marginsplot, x(neu_s3uni) xlabel(-1(0.5)1)
		
		*Create Contour Plot for Interaction Variables - Recipient
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_recipient=(-2.2(1)4.8)) saving(model2recippredictions, replace)
		use model2recippredictions, clear
		rename _at4 neu_s3uni
		rename _at2 neu_powerpc_recipient
		rename _margin pr_diploengagement
		twoway (contour pr_diploengagement neu_powerpc_recipient neu_s3uni,/*
		*/ccuts(0(0.1)1)), ylabel(-2.2(1)4.8, angle(horizontal)) xtitle("{bf}Affinity")/*
		*/ytitle("{bf}Recipient Power (standard dev.)") ztitle("{bf}Probability of Embassy Presence")/*
		*/title("{bf}Interaction Effect of Recipient Power on Affinity as a Driver""{bf}of Embassy Presence: Model 2")/*
		*/scheme(s2mono)
		
		*Create Contour Plot for Interaction Variables - Sender
		use final_5_yr_blocks.dta, clear
		xi: logistic  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient ///
		  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
		  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
		  neu_westandruscoldummy if  Corrected_samedyad==0, cluster( neu_dyadid)		
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_sender=(-2.2(1)4.8)) saving(model2sendpredictions, replace)
		use model2sendpredictions, clear
		rename _at4 neu_s3uni
		rename _at3 neu_powerpc_sender
		rename _margin pr_diploengagement
		twoway (contour pr_diploengagement neu_powerpc_sender neu_s3uni,/*
		*/ccuts(0(0.1)1)), ylabel(-2.2(1)4.8, angle(horizontal)) xtitle("{bf}Affinity")/*
		*/ytitle("{bf}Sender Power (standard dev.)") ztitle("{bf}Probability of Embassy Presence")/*
		*/title("{bf}Interaction Effect of Sender Power on Affinity as a Driver""{bf}of Embassy Presence: Model 2")/*
		*/scheme(s2mono)

*Model 3: Neumayer Data + year + reciprocity
use final_5_yr_blocks.dta, clear
xi: logistic  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient ///
  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
  neu_westandruscoldummy neu_dr_at_sender_dum   i.year if  Corrected_samedyad==0, cluster( neu_dyadid)

estat class
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans
eststo neumayer_year_recip

		*Create Margins Plot for Interaction Variables
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_recipient=(-2.2(1)4.8)) 
		marginsplot, x(neu_s3uni) xlabel(-1(0.5)1)
		
		*Create Margins Plot for Interaction Variables
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_sender=(-2.2(1)4.8)) 
		marginsplot, x(neu_s3uni) xlabel(-1(0.5)1)

		*Create Contour Plot for Interaction Variables - Recipient
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_recipient=(-2.2(1)4.8)) saving(model3recippredictions, replace)
		use model3recippredictions, clear
		rename _at4 neu_s3uni
		rename _at2 neu_powerpc_recipient
		rename _margin pr_diploengagement
		twoway (contour pr_diploengagement neu_powerpc_recipient neu_s3uni,/*
		*/ccuts(0(0.1)1)), ylabel(-2.2(1)4.8, angle(horizontal)) xtitle("{bf}Affinity")/*
		*/ytitle("{bf}Recipient Power (standard dev.)") ztitle("{bf}Probability of Embassy Presence")/*
		*/title("{bf}Interaction Effect of Recipient Power on Affinity as a Driver""{bf}of Embassy Presence: Model 3")/*
		*/scheme(s2mono)
		
		*Create Contour Plot for Interaction Variables - Sender
		use final_5_yr_blocks.dta, clear
		xi: logistic  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient ///
		  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
		  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
		  neu_westandruscoldummy if  Corrected_samedyad==0, cluster( neu_dyadid)		
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_sender=(-2.2(1)4.8)) saving(model3sendpredictions, replace)
		use model3sendpredictions, clear
		rename _at4 neu_s3uni
		rename _at3 neu_powerpc_sender
		rename _margin pr_diploengagement
		twoway (contour pr_diploengagement neu_powerpc_sender neu_s3uni,/*
		*/ccuts(0(0.1)1)), ylabel(-2.2(1)4.8, angle(horizontal)) xtitle("{bf}Affinity")/*
		*/ytitle("{bf}Sender Power (standard dev.)") ztitle("{bf}Probability of Embassy Presence")/*
		*/title("{bf}Interaction Effect of Sender Power on Affinity as a Driver""{bf}of Embassy Presence: Model 3")/*
		*/scheme(s2mono)	

****Primary Results with Embassy Data****

*Model 4: Diplometrics Data
use final_5_yr_blocks.dta, clear
xi: logistic  binemb_neubirth   neu_lndistance neu_powerpc_recipient neu_powerpc_sender ///
  neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender ///
  neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy ///
  if  Corrected_samedyad==0, cluster( neu_dyadid)

estat class
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
			*Re-run margins command & save results for combo margins plot
			margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 (0.1) 4.8)) atmeans saving(model4rec, replace)
			*Create a conditional margins plot with shaded confidence intervals
			marginsplot, x(neu_powerpc_recipient)recastci(rarea) xlabel(-2.2(1)4.8)
			*Store model estimates
			est store model4rec
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
marginsplot, x(neu_powerpc_sender)recastci(rarea) xlabel(-2.2(1)4.8)
margins, dydx(*) atmeans
eststo diplo

		*Create Margins Plot for Interaction Variables
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_recipient=(-2.2(1)4.8)) 
		marginsplot, x(neu_s3uni) xlabel(-1(0.5)1)
		
		*Create Margins Plot for Interaction Variables
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_sender=(-2.2(1)4.8)) 
		marginsplot, x(neu_s3uni) xlabel(-1(0.5)1)
		
		*Create Contour Plot for Interaction Variables - Recipient
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_recipient=(-2.2(1)4.8)) saving(model4recippredictions, replace)
		use model4recippredictions, clear
		rename _at4 neu_s3uni
		rename _at2 neu_powerpc_recipient
		rename _margin pr_diploengagement
		twoway (contour pr_diploengagement neu_powerpc_recipient neu_s3uni,/*
		*/ccuts(0(0.1)1)), ylabel(-2.2(1)4.8, angle(horizontal)) xtitle("{bf}Affinity")/*
		*/ytitle("{bf}Recipient Power (standard dev.)") ztitle("{bf}Probability of Embassy Presence")/*
		*/title("{bf}Interaction Effect of Recipient Power on Affinity as a Driver""{bf}of Embassy Presence: Model 4")/*
		*/scheme(s2mono)
		
		*Create Contour Plot for Interaction Variables - Sender
		use final_5_yr_blocks.dta, clear
		xi: logistic  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient ///
		  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
		  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
		  neu_westandruscoldummy if  Corrected_samedyad==0, cluster( neu_dyadid)		
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_sender=(-2.2(1)4.8)) saving(model4sendpredictions, replace)
		use model4sendpredictions, clear
		rename _at4 neu_s3uni
		rename _at3 neu_powerpc_sender
		rename _margin pr_diploengagement
		twoway (contour pr_diploengagement neu_powerpc_sender neu_s3uni,/*
		*/ccuts(0(0.1)1)), ylabel(-2.2(1)4.8, angle(horizontal)) xtitle("{bf}Affinity")/*
		*/ytitle("{bf}Sender Power (standard dev.)") ztitle("{bf}Probability of Embassy Presence")/*
		*/title("{bf}Interaction Effect of Sender Power on Affinity as a Driver""{bf}of Embassy Presence: Model 4")/*
		*/scheme(s2mono)

*Model 5: Diplometrics Data + year
use final_5_yr_blocks.dta, clear
xi: logistic  binemb_neubirth   neu_lndistance neu_powerpc_recipient neu_powerpc_sender ///
  neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender ///
  neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy ///
  i.year if  Corrected_samedyad==0, cluster( neu_dyadid)

estat class
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans
eststo diplo_year
 
		*Create Margins Plot for Interaction Variables
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_recipient=(-2.2(1)4.8)) 
		marginsplot, x(neu_s3uni) xlabel(-1(0.5)1)
	
		*Create Margins Plot for Interaction Variables
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_sender=(-2.2(1)4.8)) 
		marginsplot, x(neu_s3uni) xlabel(-1(0.5)1)

		*Create Contour Plot for Interaction Variables - Recipient
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_recipient=(-2.2(1)4.8)) saving(model5recippredictions, replace)
		use model5recippredictions, clear
		rename _at4 neu_s3uni
		rename _at2 neu_powerpc_recipient
		rename _margin pr_diploengagement
		twoway (contour pr_diploengagement neu_powerpc_recipient neu_s3uni,/*
		*/ccuts(0(0.1)1)), ylabel(-2.2(1)4.8, angle(horizontal)) xtitle("{bf}Affinity")/*
		*/ytitle("{bf}Recipient Power (standard dev.)") ztitle("{bf}Probability of Embassy Presence")/*
		*/title("{bf}Interaction Effect of Recipient Power on Affinity as a Driver""{bf}of Embassy Presence: Model 5")/*
		*/scheme(s2mono)
	
	
		*Create Contour Plot for Interaction Variables - Sender
		use final_5_yr_blocks.dta, clear
		xi: logistic  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient ///
		  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
		  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
		  neu_westandruscoldummy if  Corrected_samedyad==0, cluster( neu_dyadid)		
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_sender=(-2.2(1)4.8)) saving(model5sendpredictions, replace)
		use model5sendpredictions, clear
		rename _at4 neu_s3uni
		rename _at3 neu_powerpc_sender
		rename _margin pr_diploengagement
		twoway (contour pr_diploengagement neu_powerpc_sender neu_s3uni,/*
		*/ccuts(0(0.1)1)), ylabel(-2.2(1)4.8, angle(horizontal)) xtitle("{bf}Affinity")/*
		*/ytitle("{bf}Sender Power (standard dev.)") ztitle("{bf}Probability of Embassy Presence")/*
		*/title("{bf}Interaction Effect of Sender Power on Affinity as a Driver""{bf}of Embassy Presence: Model 5")/*
		*/scheme(s2mono)

 
*Model 6: Diplometrics data + year + reciprocity
use final_5_yr_blocks.dta, clear
xi: logistic  binemb_neubirth   neu_lndistance neu_powerpc_recipient neu_powerpc_sender  ///
  neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender ///
  neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy ///
  binemb_sender   i.year if  Corrected_samedyad==0, cluster( neu_dyadid)

estat class
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans
eststo diplo_year_recip
esttab neumayer neumayer_year neumayer_year_recip diplo diplo_year diplo_year_recip ///
using neumayer_ouput_5.12.csv, eform aic bic  pr2 obslast compress replace
 
		*Create Contour Plot for Interaction Variables - Recipient
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_recipient=(-2.2(1)4.8)) saving(model6recippredictions, replace)
		use model6recippredictions, clear
		rename _at4 neu_s3uni
		rename _at2 neu_powerpc_recipient
		rename _margin pr_diploengagement
		twoway (contour pr_diploengagement neu_powerpc_recipient neu_s3uni,/*
		*/ccuts(0(0.1)1)), ylabel(-2.2(1)4.8, angle(horizontal)) xtitle("{bf}Affinity")/*
		*/ytitle("{bf}Recipient Power (standard dev.)") ztitle("{bf}Probability of Embassy Presence")/*
		*/title("{bf}Interaction Effect of Recipient Power on Affinity as a Driver""{bf}of Embassy Presence: Model 6")/*
		*/scheme(s2mono)

		*Create Contour Plot for Interaction Variables - Sender		
		use final_5_yr_blocks.dta, clear
		xi: logistic  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient ///
		  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
		  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
		  neu_westandruscoldummy if  Corrected_samedyad==0, cluster( neu_dyadid)		
		margins, at(neu_s3uni=(-1 (0.1) 1) neu_powerpc_sender=(-2.2(1)4.8)) saving(model6sendpredictions, replace)
		use model6sendpredictions, clear
		rename _at4 neu_s3uni
		rename _at3 neu_powerpc_sender
		rename _margin pr_diploengagement
		twoway (contour pr_diploengagement neu_powerpc_sender neu_s3uni,/*
		*/ccuts(0(0.1)1)), ylabel(-2.2(1)4.8, angle(horizontal)) xtitle("{bf}Affinity")/*
		*/ytitle("{bf}Sender Power (standard dev.)") ztitle("{bf}Probability of Embassy Presence")/*
		*/title("{bf}Interaction Effect of Sender Power on Affinity as a Driver""{bf}of Embassy Presence: Model 6")/*
		*/scheme(s2mono)

		*Create Figure 3
		use final_5_yr_blocks.dta, clear
		combomarginsplot model1rec.dta model4rec.dta, labels("Model 1: COW" "Model 4: DDR")

****Robustness checks****
use final_5_yr_blocks.dta, clear
*Double-check
xi: logit  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy neu_bilattradegdp_sender  i.year if  Corrected_samedyad==0, cluster( neu_dyadid) or
xi: logit  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy neu_independence_sender c.neu_independence_sender#c.neu_independence_sender i.year if  Corrected_samedyad==0, cluster( neu_dyadid) or
xi: logit  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy  i.year if  Corrected_samedyad==0 & year<1990, cluster( neu_dyadid) or
xi: logit  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy  i.year if  Corrected_samedyad==0 & year>=1990, cluster( neu_dyadid) or

* LDV - new embassy data
sort neu_dyadid year
by neu_dyadid: gen lbinemb = binemb[_n-1]
xi: logit  binemb  lbinemb  neu_lndistance neu_powerpc_recipient neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy  i.year if  Corrected_samedyad==0, cluster( neu_dyadid)
estat class
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans

*bilateral trade - new embassy data
xi: logit  binemb_neubirth   neu_lndistance neu_powerpc_recipient neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy neu_bilattradegdp_sender  i.year, cluster( neu_dyadid)
estat class
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans

* Include year of independence - new embassy data
xi: logit  binemb   neu_lndistance neu_powerpc_recipient neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy neu_independence_sender c.neu_independence_sender#c.neu_independence_sender i.year if  Corrected_samedyad==0, cluster( neu_dyadid)
estat class
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans

*Cold War versus post-Cold War
xi: logit  binemb   neu_lndistance neu_powerpc_recipient neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy  i.year if  Corrected_samedyad==0 & year<1990, cluster( neu_dyadid)
estat class
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans

xi: logit  binemb   neu_lndistance neu_powerpc_recipient neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy  i.year if  Corrected_samedyad==0 & year>=1990, cluster( neu_dyadid)
estat class
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans


clear

*****************************************************************************************
**********************************CHECK PRE & POST 1985**********************************
*****************************************************************************************
log close
log using "analysis_1985.log", replace
use final_5_yr_blocks.dta, clear

*Pre-1985

*SUMMARY
su neu_dr_at_recipient_dum binemb_neubirth neu_lndistance neu_powerpc_recipient ///
 neu_powerpc_sender    neu_s3uni  neu_lngdppc_recipient  neu_lngdppc_sender  ///
 c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender  ///
 neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy ///
 neu_dr_at_sender_dum  neu_bilattradegdp_sender neu_independence_sender ///
 neu_demdem neu_autocautoc  if post1985==0

*primary results - original data
xi: logit  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient ///
  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
  neu_westandruscoldummy  i.year if  Corrected_samedyad==0 & post1985==0, cluster( neu_dyadid)

estat class
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans

 eststo neu_pre1985


*primary results - new embassy data
xi: logit  binemb_neubirth   neu_lndistance neu_powerpc_recipient neu_powerpc_sender ///
  neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender ///
  neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy ///
  i.year if  Corrected_samedyad==0 & post1985==0, cluster( neu_dyadid)

estat class
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans

 eststo binemb_pre1985
 

 ***POST 1985***

 *SUMMARY
su neu_dr_at_recipient_dum binemb_neubirth neu_lndistance neu_powerpc_recipient ///
 neu_powerpc_sender    neu_s3uni  neu_lngdppc_recipient  neu_lngdppc_sender  ///
 c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender  ///
 neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy ///
 neu_dr_at_sender_dum  neu_bilattradegdp_sender neu_independence_sender ///
 neu_demdem neu_autocautoc  if post1985==1

*primary results - original data
xi: logit  neu_dr_at_recipient_dum   neu_lndistance neu_powerpc_recipient ///
  neu_powerpc_sender    neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  ///
  c.neu_s3uni#c.neu_powerpc_sender  neu_lngdppc_recipient  neu_lngdppc_sender ///
  neu_westandruscoldummy  i.year if  Corrected_samedyad==0 & post1985==1, cluster( neu_dyadid)

estat class
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans

 eststo neu_post1985


*primary results - new embassy data
xi: logit  binemb_neubirth   neu_lndistance neu_powerpc_recipient neu_powerpc_sender ///
  neu_s3uni   c.neu_s3uni#c.neu_powerpc_recipient  c.neu_s3uni#c.neu_powerpc_sender ///
  neu_lngdppc_recipient  neu_lngdppc_sender  neu_westandruscoldummy ///
  i.year if  Corrected_samedyad==0 & post1985==1, cluster( neu_dyadid)

estat class
margins, dydx(neu_s3uni) at(neu_powerpc_recipient=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans

 eststo binemb_post1985


 esttab neu_pre1985 neu_post1985 binemb_pre1985 binemb_post1985 ///
 using neumayer_ouput_1985.csv, eform aic bic  pr2 obslast compress replace
 
 estimates clear

*****************************************************************************************
************************ANNUAL RECREATION - Neumayer/Diplo Obs Matched *********************
*****************************************************************************************
log close
log using "analysis2.log", replace

use annual.dta, clear

quietly xi: logit  neu_dr_rcpt_ann neu_lndist_ann  neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann ///
c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann if  Corrected_samedyad==0,

gen neu_sample = e(sample)

quietly xi: logit  binemb_neubirth neu_lndist_ann  neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann ///
c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann if  Corrected_samedyad==0,

gen binemb_sample = e(sample)

replace binemb_neubirth = . if binemb_sample ==1 & neu_sample ==0

set more off
xtset dyadidn year
 
*order variables

order countrya countryb year binemb_neubirth neu_dr_rcpt_ann neu_lndist_ann  neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann ///
 neu_westandruscoldummy_ann Corrected_samedyad dyadidn neu_lngdppc_sender_ann neu_lngdppc_recipient_ann
  

* Table 1 - original data
quietly xi: logit neu_dr_rcpt_ann neu_lndist_ann  neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann ///
c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann if  Corrected_samedyad==0,

sum binemb_neubirth neu_dr_rcpt_ann neu_lndist_ann  neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann ///
c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann  neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann Corrected_samedyad  if e(sample)
 
 
***annual recreation with years as FE
 
 xi: logistic  neu_dr_rcpt_ann neu_lndist_ann  neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann ///
 c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann  neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann i.year if  Corrected_samedyad==0,  cluster( dyadidn) 
 
estat class
margins, dydx(neu_s3uni_ann) at(neu_powerpc_recipient_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans 

 eststo neumayer

 **annual recreation with years as FE and diplometrics embassies

 xi: logistic  binemb_neubirth  neu_lndist_ann neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann  ///
 c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann i.year if  Corrected_samedyad==0,  cluster(dyadidn)

estat class
margins, dydx(neu_s3uni_ann) at(neu_powerpc_recipient_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans
 
 eststo neu_binemb_ann

 **Annual recreation with no years
 
 xi: logistic  neu_dr_rcpt_ann neu_lndist_ann  neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann ///
 c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann  neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
  neu_westandruscoldummy_ann if  Corrected_samedyad==0,  cluster( dyadidn) 
  
estat class
margins, dydx(neu_s3uni_ann) at(neu_powerpc_recipient_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans 

eststo neu_original_ann_nyr


 **Annual recreation with no years and Diplometrics embassies
 
 xi: logistic  binemb_neubirth  neu_lndist_ann neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann  ///
 c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann  neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann if  Corrected_samedyad==0,  cluster( dyadidn)

* estat class
margins, dydx(neu_s3uni_ann) at(neu_powerpc_recipient_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans

 eststo neu_binemb_ann_nyr
 
**Annual recreation with years as IVs
xi: logistic  neu_dr_rcpt_ann neu_lndist_ann  neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann ///
 c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann year if  Corrected_samedyad==0,  cluster( dyadidn)
 
 estat class
margins, dydx(neu_s3uni_ann) at(neu_powerpc_recipient_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans 
 
eststo neu_original_ann_yr

 **Annual recreation with years as IVs and Diplometrics embassies
 
 xi: logistic  binemb_neubirth  neu_lndist_ann neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann  ///
 c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann  neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann year if  Corrected_samedyad==0,  cluster( dyadidn)

estat class
margins, dydx(neu_s3uni_ann) at(neu_powerpc_recipient_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
*margins, dydx(*) atmeans
 
 eststo neu_binemb_ann_yr
 


 esttab neumayer neu_binemb_ann neu_original_ann_nyr neu_binemb_ann_nyr  neu_original_ann_yr neu_binemb_ann_yr   ///
 using neumayer_ann_ouput_extra_obs_removed.csv, eform aic bic  pr2 compress replace
 


  
 quietly xi: logit  neu_dr_rcpt_ann neu_lndist_ann  neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann ///
 c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann  neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann i.year if  Corrected_samedyad==0,  cluster( dyadidn) 
 

  
*****************************************************************************************
**********************ANNUAL RECREATION - CHECK PRE & POST 1985**************************
*****************************************************************************************

*SUMMARY*
sum binemb_neubirth neu_dr_rcpt_ann neu_lndist_ann  neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann ///
c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann  neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann Corrected_samedyad  if post1985==0
 
 
 **annual recreation with years as FE
 
 xi: logit  neu_dr_rcpt_ann neu_lndist_ann  neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann ///
 c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann  neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann i.year if  Corrected_samedyad==0 & post1985 ==0,  cluster( dyadidn) 
 
estat class
margins, dydx(neu_s3uni_ann) at(neu_powerpc_recipient_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans
eststo neu_ann_pre1985
 
 **annual recreation with years as FE and diplometrics embassies

 xi: logit  binemb_neubirth  neu_lndist_ann neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann  ///
 c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann i.year if  Corrected_samedyad==0 & post1985==0,  cluster(dyadidn)

estat class
margins, dydx(neu_s3uni_ann) at(neu_powerpc_recipient_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans

 
 eststo binemb_ann_pre1985


***POST 1985***

*SUMMARY*
sum binemb_neubirth neu_dr_rcpt_ann neu_lndist_ann  neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann ///
c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann  neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann Corrected_samedyad  if post1985==1
 
 **annual recreation with years as FE
 
 xi: logit  neu_dr_rcpt_ann neu_lndist_ann  neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann ///
 c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann  neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann i.year if  Corrected_samedyad==0 & post1985 ==1,  cluster( dyadidn) 
 
estat class
margins, dydx(neu_s3uni_ann) at(neu_powerpc_recipient_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans
eststo neu_ann_post1985
 
 **annual recreation with years as FE and diplometrics embassies

 xi: logit  binemb_neubirth  neu_lndist_ann neu_powerpc_recipient_ann neu_powerpc_sender_ann   neu_s3uni_ann  ///
 c.neu_s3uni_ann#c.neu_powerpc_recipient_ann  c.neu_s3uni_ann#c.neu_powerpc_sender_ann neu_lngdppc_sender_ann neu_lngdppc_recipient_ann ///
 neu_westandruscoldummy_ann i.year if  Corrected_samedyad==0 & post1985==1,  cluster(dyadidn)

estat class
margins, dydx(neu_s3uni_ann) at(neu_powerpc_recipient_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(neu_s3uni) at(neu_powerpc_sender_ann=(-2.2 -1.2 -.2 .8 1.8 2.8 3.8 4.8)) atmeans
margins, dydx(*) atmeans

 
 eststo binemb_ann_post1985

 esttab  neu_ann_pre1985 neu_ann_post1985  binemb_ann_pre1985 binemb_ann_post1985 ///
 using neumayer_ann_ouput_extra_obs_removed_1985.csv, eform aic bic  pr2 compress replace

